<?php 
	session_start(); 
	include('../user_type/system.php');
	include('../access/login_functions.php');
	include("../access/opendb.php"); 
	$_SESSION['restricted'] = true;
	check_logged_in();	if ($_SESSION['Status'] == "NewModerator") { send_to_page('firstTimeLogin.php'); }	if ($_SESSION['Status'] == "NewModerator") { send_to_page('firstTimeLogin.php'); }	if ($_SESSION['Status'] == "NewModerator") { send_to_page('firstTimeLogin.php'); }
	
	
	// check if the UID is set and a decision has been made
	if (isset($_POST['UID']) && isset($_POST['decision']) && isset($_POST['username']))
	{
		$UID = $_POST['UID'];
		$username = $_POST['username'];
		$decision = $_POST['decision'];
		
		if ($decision == "Approve Membership")
		{
			System::makeMember($UID);
			$_SESSION['newMember'] = "$username has now become a new member!";
		}
		elseif ($decision == "Deny Membership")
		{
			System::banUser($UID);
			$_SESSION['newMember'] = "$username has been denied membership!";
		}
	}
	
	
	$curPage = $_SESSION['curPage'];
	include("../access/closedb.php");
	send_to_page("../$curPage");
?>